package com.chen.springmvc.service.impl;

import com.chen.springmvc.dao.mapper.UserMapper;
import com.chen.springmvc.domain.User;
import com.chen.springmvc.service.api.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements IUserService
{
    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> findAllUsers()
    {
        return userMapper.findAllUsers();
    }

    @Override
    public User findById(long id)
    {
        return userMapper.findById(id);
    }

    @Override
    public boolean isUserExist(User user)
    {
        return userMapper.isUserExist(user);
    }

    @Override
    public void saveUser(User user)
    {
        userMapper.saveUser(user);
    }

    @Override
    public void updateUser(User currentUser)
    {
        userMapper.updateUser(currentUser);
    }

    @Override
    public void deleteUserById(long id)
    {
        userMapper.deleteUserById(id);
    }

    @Override
    public void deleteAllUsers()
    {
        userMapper.deleteAllUsers();
    }
}
